package com.cn.wanxi.springsecurity.service.impl;

import com.cn.wanxi.springsecurity.domain.Permission;
import com.cn.wanxi.springsecurity.domain.User;
import com.cn.wanxi.springsecurity.mapper.UserMapper;
import com.cn.wanxi.springsecurity.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 后台用户表 服务实现类
 * </p>
 *
 * @author 吉酱
 * @since 2022-09-26
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public int addUser(User user) {


        return userMapper.insert(user);
    }

    @Override
    public int deleteUserById(Integer id) {

        return userMapper.deleteById(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateById(user);
    }

    @Override
    public User getUserById(Integer id) {

        return userMapper.selectById(id);

    }

    @Override
    public List<User> getAllUser(User user) {

        return userMapper.selectAll();
    }


}
